<?php

namespace App\Validate;

class OilChannelValidation extends BaseValidation
{
    // 调用案例 check支持自定义规则

    // make(AmountValidation::class)->check($this->request->all(),__FUNCTION__)

    //返回响应值的  ->response()

    //返回boole   ->get()

    //返回报错信息  ->getError()

    //验证规则
    protected $rule =[
        'id'=>'required|integer',
        'name'=>'required',
        'channel_sn'=>'required',
        'api_info'=>'required|json',
        'merchant_no'=>'required',
        'api_name'=>'required',
        'appkey'=>'required',
        'status'=>'required|in:1,2',
        'start_time'=>'required|date',
        'sort'=>'required',
        'type'=>'required|in:1,2',
        'remark'=>'required',
        'recharge_amount'=>'required',

    ];
    //自定义验证信息
    protected $message = [
        'name.required'=>'合作商名称 必须',
        'channel_sn.required'=>'合作商ID 必须',
        'api_info.required'=>'合作商api信息 必须',
        'merchant_no.required'=>'商户号 必须',
        'api_name.required'=>'合作商api名称 必须',
        'appkey.required'=>'合作商appkey 必须',
        'start_data.required'=>'上线时间 必须',

    ];
    
    //自定义场景
    protected $scene = [
        'add'=>"name,channel_sn,api_info,merchant_no,api_name,appkey,status,start_time,sort,type",
        'edit_get'=>"id",
        'edit_post'=>"id,name,channel_sn,api_info,merchant_no,api_name,appkey,status,start_time,sort,type",
        'del'=>"id",
        'remark_get'=>"id",
        'remark_post'=>"id,remark",
        'rechargeAmount_get'=>"id",
        'rechargeAmount_post'=>"id,recharge_amount",
    ];
}
